//
//  MusicCircleController.m
//  迷笛
//
//  Created by . on 2018/9/5.
//  Copyright © 2018年 🍃🌺🌺🍃. All rights reserved.
//

#import "MIDIMusicCircleController.h"
#import "MIDIrecommendedController.h"
#import "MIDImusicController.h"
#import "MIDIfoundController.h"
#import "RedRCSegmentView.h"
#import "ViewController.h"
@interface MIDIMusicCircleController ()
@property(nonatomic,strong)UIButton * btn;
@property(nonatomic,strong)UIButton * btn1;
@property(nonatomic,strong)NSString * apptoken;
@end

@implementation MIDIMusicCircleController

- (void)viewDidLoad {
    [super viewDidLoad];
    #define  HEIGHT [UIScreen mainScreen].bounds.size.height
    #define  WIDTH  [UIScreen mainScreen].bounds.size.width
    self.view.backgroundColor = [UIColor colorWithHexString:@"#1B212F"];


    MIDIrecommendedController * First =     [[MIDIrecommendedController alloc] initWithCategoryId:@"0"];
    MIDIrecommendedController * Second =    [[MIDIrecommendedController alloc] initWithCategoryId:@"1"];
    MIDIrecommendedController * one =       [[MIDIrecommendedController alloc] initWithCategoryId:@"2"];
    MIDIrecommendedController * two =       [[MIDIrecommendedController alloc] initWithCategoryId:@"3"];
    MIDIrecommendedController * three =     [[MIDIrecommendedController alloc] initWithCategoryId:@"4"];
    
    NSArray *controllers=@[First,Second,one,two,three];
    
    NSArray *titleArray =@[@"推荐",@"音乐人",@"演出现场",@"粉圈",@"跳蚤市场"];
    RedRCSegmentView * rcs=[[RedRCSegmentView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, kDevice_Is_iPhoneX?HeighX(700):HeightScale(558)) controllers:controllers titleArray:titleArray ParentController:self];
    rcs.backgroundColor =[UIColor colorWithHexString:@"#1B212F"];
    [self.view addSubview:rcs];
    [self homeUI];
}

- (void)viewWillAppear:(BOOL)animated
{
    //   黑色字变为白色
    self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
    self.navigationController.navigationBar.translucent = NO;//Bar的模糊效果，默认为YES

    self.tabBarController.tabBar.hidden = NO;
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithHexString:@"#171717"];
    self.title = @"乐动圈";
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#FFFFFF"],NSFontAttributeName : [UIFont fontWithName:@"Helvetica-Bold" size:WidthScale(17)]}];
    //    去掉导航黑线
    UIImage *img = [UIImage imageNamed:@""];
    [self.navigationController.navigationBar setBackgroundImage:img  forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage = [[UIImage alloc] init];
}
-(void)homeUI
{
    [self.view addSubview:self.btn1];
    [self.btn1 mas_makeConstraints:^(MASConstraintMaker *make)
    {
        make.bottom.mas_offset(kDevice_Is_iPhoneX?HeighX(-94):HeightScale(-70));
        make.right.mas_offset(WidthScale(-20));
        make.width.mas_offset(WidthScale(60));
        make.height.mas_offset(kDevice_Is_iPhoneX?HeighX(60):HeightScale(60));
    }];
}
-(UIButton *)btn1
{
    if (!_btn1)
    {
        _btn1 =[[UIButton alloc]init];
//        [_btn1 setBackgroundColor:[UIColor redColor]];
        [_btn1 setBackgroundImage:[UIImage imageNamed:@"floatbar"] forState:0];
        [_btn1 addTarget:self action:@selector(newbtn) forControlEvents:UIControlEventTouchUpInside];
//        //将多余的部分切掉
//        _btn1.layer.masksToBounds = YES;
    }
    return _btn1;
}
-(void)newbtn
{
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    _apptoken = [user objectForKey:@"APPToken"];
        
    if (self.apptoken == nil)
    {
        [[NSNotificationCenter defaultCenter] postNotificationName:@"notification_modal_login" object:nil];
        
        return;
    }
    else
    {
        MIDIfoundController * foud =[[MIDIfoundController alloc]init];
        [self.navigationController pushViewController:foud animated:YES];
    }
}


@end
